<!-- 导航管理页面 -->
<template>
  <div>
    <!-- 卡片视图 -->
    <el-card>
      <!-- 渲染主体 -->
      <div class="app-container">
        <!-- 头部 -->
        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" style="margin: 10px 30px 20px 10px;" label-width="70px">
          <el-form-item label="系统名称" prop="sysName">
            <el-input
              v-model="queryParams.sysName"
              placeholder="请输入系统名称"
              clearable
              @keyup.enter.native="getqueryNavigations"/>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" @click="handleQuery" style="margin: 0px 10px 0px 30px;">搜索</el-button>
            <el-button type="primary" plain icon="el-icon-plus" @click="handleAdd" style="margin: 0px 10px 0px 30px;">新增</el-button>
          </el-form-item>
        </el-form>

        <el-table v-loading="loading" :data="supplierMgmtList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="序号" align="center" prop="sysId" sortable />
          <el-table-column label="系统名称" align="center" prop="sysName" />
          <el-table-column label="管理员" align="center" prop="admin" width="250px"/>
          <el-table-column label="发布" align="center" key="status" v-if="columns[4].visible" width="50px">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
            </template>
          </el-table-column>
          <el-table-column label="系统分类" align="center" prop="sysType" />
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
              <el-button size="mini" type="text" icon="el-icon-edit" @click="turnoptions(scope.row)">移交</el-button>
              <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>

        <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
        <!-- 添加或修改供应商管理对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body center>
          <el-form ref="form" :model="form" :rules="rules" label-width="150px">
            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="系统名称" prop="sysName">
                  <el-input v-model="form.sysName" placeholder="请输入系统名称(示例：导航系统)" style="width: 368px;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="系统描述" prop="description">
                  <el-input v-model="form.description" placeholder="请输入系统描述(示例：企业内部系统导航栏)" style="width: 368px;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="系统标签" prop="sysLabel">
                  <el-input v-model="form.sysLabel" placeholder="请输入系统标签(示例：导航,搜索)" style="width: 368px;" id="SYSLABEL" />
                </el-form-item>
              </el-col>
            </el-row>
            <!-- <el-row :gutter="9">
          <el-col :span="12"> -->
            <el-form-item label="系统分类" prop="sysType">
              <el-checkbox-group v-model="form.sysType" size="medium">
                <el-checkbox label="OP" :disabled="zios" @change="changeOP">生产</el-checkbox>
                <el-checkbox label="QC" :disabled="boo" @change="changeQC">品质</el-checkbox>
                <el-checkbox label="IT" :disabled="boo" @change="changeIT">资讯</el-checkbox>
                <el-checkbox label="PUR" :disabled="boo" @change="changePUR">采购</el-checkbox>
                <el-checkbox label="OA" :disabled="boo" @change="changeOA">综合</el-checkbox>
              </el-checkbox-group>
            </el-form-item>

            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="BU" prop="sysBu">
                  <el-checkbox-group v-model="form.sysBu" size="medium">
                    <el-checkbox label="BU1" :disabled="zios1" @change="changeBU1"></el-checkbox>
                    <el-checkbox label="BU3" :disabled="boo1" @change="changeBU3"></el-checkbox>
                    <el-checkbox label="BU5" :disabled="boo1" @change="changeBU5"></el-checkbox>
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="导航图">
                  <el-upload class="upload-demo" action="http://appservice.casetekcorp.com:8443/sso_back/navigation/saveImg" :on-preview="handlePreview"
                    :on-remove="handleRemove" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
                    :on-exceed="handleExceed" :limit="1" :file-list="fileList" list-type="picture" :headers="Myhead">
                    <el-button size="small" type="primary" @click="handlePreview">点击上传</el-button>
                    <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="SOP链接" prop="sopUrl">
                  <el-input v-model="form.sopUrl" placeholder="请输入SOP链接" style="width: 368px;" />
                  <p class="form_sample_code">SOP示例：http://appservice.casetekcorp.com:8443/PmsWeb/pages/Q&A.html</p>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="SSO链接" prop="sysUrl">
                  <el-input v-model="form.sysUrl" placeholder="请输入SSO链接" style="width: 368px;" />
                  <p class="form_sample_code">SSO示例：http://appservice.casetekcorp.com:8443/PmsWeb/index.html</p>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="9">
              <el-col :span="12">
                <el-form-item label="登录链接" prop="loginUrl">
                  <el-input v-model="form.loginUrl" placeholder="请输入登录链接" style="width: 368px;" />
                  <p class="form_sample_code">登录示例：http://appservice.casetekcorp.com:8443/PmsWeb/pages/login.html</p>
                </el-form-item>
              </el-col>
            </el-row>
            <el-divider content-position="center">联系人</el-divider>
            <el-row style="position: relative;">
              <el-col :span="11">
                <el-form-item label="工号" prop="founder">
                  <el-input v-model="form.founder" placeholder="请输入工号" id="userIdInput" maxlength="11" />
                  <el-button type="primary" icon="el-icon-plus" size="mini" style=" position: absolute;top: 6px;left: 202px;"
                    @click="editelmployId">验证
                  </el-button>
                </el-form-item>
              </el-col>
              <el-col :span="11">
                <el-form-item label="姓名">
                  <el-input v-model="form.linkMan1" :clearable="empty" :disabled="true" placeholder="用户姓名" id="linkManInput" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="11">
                <el-form-item label="责任事项" prop="duty">
                  <!-- <el-input v-model="form.duty" :clearable="empty" :disabled="true" placeholder="请获取责任事项" id="dutyInput"/> -->
                  <el-select v-model="dutyList" placeholder="请选择" @change="aa(value)">
                    <el-option
                      v-for="item in options" 
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="11">
                <el-form-item>
                  <el-button id="verification" type="primary" :disabled="verification" icon="el-icon-plus" size="mini" @click="editTitle">添加
                  </el-button>
                  <!-- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteNetworkDetails">删除</el-button> -->
                </el-form-item>
              </el-col>

            </el-row>
            <el-table :data="gridData">
              <el-table-column type="selection" width="55" align="center" />
              <el-table-column label="序号" align="center">
                <template scope="scope">
                  <span>{{scope.$index + 1 }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="linkMan" label="姓名" width="120" key="linkMan" :show-overflow-tooltip="true"></el-table-column>
              <el-table-column prop="employeeId" key="employeeId" label="工号" width="120"></el-table-column>
              <el-table-column prop="duty" key="duty" label="责任事项" width="120">
              </el-table-column>
              <el-table-column label="删除" align="center" width="160" class-name="small-padding fixed-width">
                <template slot-scope="scope" v-if="scope.row.employeeId !== 1">
                  <el-button size="mini" type="text" icon="el-icon-delete" @click="AddDelete(scope.row)">删除</el-button>
                </template>
              </el-table-column>
              <!-- <el-table-column property="title" label="排序" width="120"></el-table-column> -->
            </el-table>

          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 点击移交按钮弹窗 -->
        <el-dialog :title="sysName" :visible.sync="dialogVisible" width="25%" style="top: 20%;" center>
          <el-form ref="transferform" :model="tranferform" :rules="rules" label-width="60px">
            <el-row style="position: relative;">
              <el-col :span="17">
                <el-form-item label="工号" prop="tranferid">
                  <el-input type="text" v-model="tranferform.tranferid" placeholder="请输入工号"  id="tranferInput" maxlength="9" style="position: relative;width: 90%;"/>
                  <el-button type="primary" icon="el-icon-plus" size="mini" style=" position: absolute;margin: 6px 10px;"
                    @click="editTranferId">验证
                  </el-button>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="17">
                <el-form-item label="姓名" prop="tranferName">
                  <el-input type="text" v-model="tranferform.tranferName" :disabled="true" placeholder="用户姓名" id="linkMantranferInput" style="width: 90%;"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-col :span="17">
              <el-form-item>
                <el-button @click="submitFormtranfer" :disabled="verification" style="position: relative;margin: 0px 60px 0px 0px" >确 定</el-button>
                <el-button @click="canceltranfer" style="position: absolute">取 消</el-button>
              </el-form-item>
            </el-col>
            <br />
            <br />
          </el-form>
        </el-dialog>
      </div>
    </el-card>
</div>
</template>

<script>
  import {
    getqueryNavigations,// 查询
    getEmpById,// id
    delmangentMgmt,// 删除
    updateFounderBtn,// 移交
    updateuserMgmt,// 修改
    adduserMgmt,// 增加
    queryNavigationInfo,// 查询
    changeUserStatus,// 发布
    saveImg,// 保存图片
  } from "@/api/ssoapi/backmgt";
  import { getquerySystemInfo } from "@/api/ssoapi/sso";
  import { getToken } from "@/utils/auth";
  import Cookies from "js-cookie";
  // 引入查询个人信息接口
  import { getUserProfile } from '@/api/system/user'
import { truncate } from "fs";

  export default {
    name: "directionMgmt",
    data() {
      return {
        // select选择器选中的value值
        dutyList:'项目leader',
        fileList: [],
        a: '',
        b: '',
        c: '',
        d: '',
        e: '',
        f: '',
        zios: false,
        zios1: false,
        zios2: false,
        boo: false,
        boo1: false,
        boo2: false,
        booOA: false,
        //上传选择
        checked: false,
        //下载选择
        checkeds: false,
        checkeBU5: false,
        sysName: '',
        dialogVisible: false,
        //上传权限参数
        starte: '',
        //下载权限参数
        startes: '',
        startesBU5: '',
        gridData: [],
        // 遮罩层
        loading: true,
        // 导出遮罩层
        exportLoading: false,
        // 选中数组
        ids: [],
        projectNameOptions: ["测试1", "测试2"],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 供应商管理表格数据
        supplierMgmtList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        status: "0",
        // 默认不收藏
        isFavorites: false,
        // 系统名称
        sysId: '',
        // 系统名称
        sysName: '',
        // 系统标签
        sysLabel: '',
        // 系统类型
        sysType: '',
        // 验证是否验证通过
        verification: true,
        // 清空输入框请求的数据
        empty: true,
        // 列信息 // 放进去发布出现
        columns: [{
            key: 0,
            label: `工号`,
            visible: true
          },
          {
            key: 1,
            label: `姓名`,
            visible: true
          },
          {
            key: 2,
            label: `部门`,
            visible: true
          },
          {
            key: 3,
            label: `角色`,
            visible: true
          },
          {
            key: 4,
            label: `状态`,
            visible: true
          },
          {
            key: 5,
            label: `创建时间`,
            visible: true
          }
        ],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          // 系统名称
          sysName: null,
          // 管理员
          admin: null,
          sysType: null,
          sysBu: null,
          imgUrl: null,
          sopUrl: null,
          sysUrl: null,
          loginUrl: null,
        },
        // 表单参数
        formData: {
          sysType: '',
          sysBu: '',
          imgUrl: null,
          sopUrl: null,
          sysUrl: null,
          loginUrl: null,
        },
        // 表单参数
        form: {
          description: "",
          founder: "",
          imgUrl: "",
          linkMan: [],
          loginUrl: "",
          sopUrl: "",
          sysName: "",
          sysBu: [],
          sysLabel: "",
          sysId: "",
          sysType: [],
          sysUrl: "",
        },
        tranferform: {
          tranferid: null,
          tranferName: null,
        },
        // 表单校验
        rules: {
          sysName: [
            {required: true,message: "系统名称不能为空",trigger: "blur"}
          ],
          description: [
            {required: true,message: "系统描述不能为空",trigger: "blur"}
          ],
          tranferid: [
            {required: true,message: "移交工号不能为空",trigger: "blur"}
          ],
          sysLabel: [
            {required: true,message: "系统标签不能为空,可填多个,以英文逗号隔开",trigger: "blur"}
          ],
          sysType: [
            {required: true,message: "系统分类不能为空",trigger: "blur"}
          ],
          sysBu: [
            {required: true,message: "BU不能为空",trigger: "blur"}
          ],
          imgUrl: [
            {required: true,message: "上传图片不能为空",trigger: "blur"}
          ],
          sopUrl: [
            {required: true,message: "SOP链接不能为空",trigger: "blur"}
          ],
          sysUrl: [
            {required: true,message: "SSO链接不能为空",trigger: "blur"}
          ],
          loginUrl: [
            {required: true,message: "登录链接不能为空",trigger: "blur"}
          ],
        },
        // 获取个人信息
        roleGroup: [],
        // 获取权限管理信息
        priviList: [],
        // 获取个人信息工号
        worknumber: "",
        // 获取个人信息姓名
        workname: "",
        // 选择器数据
        options: [
          {
          value: '项目leader',
          label: '项目leader'},
          {
          value: '管理权限',
          label: '管理权限'},
          {
          value: '数据权限',
          label: '数据权限'},
          {
          value: '系统权限',
          label: '系统权限'
          }
        ],
        value: '',
        // 获取当前管理系统表格的序号
        systemIdsysId: '',
        // 获取当前移交管理系统的工号
        updateFounder: {
          checkId: '',
          userIds: '',
          systemId: '',
        }
      };
    },
    watch: {
      'this.form.duty'(newVal) {
        if(!newVal || this.form.founder || this.form.linkMan1) {
          this.verification = true;
        }else {
          this.verification = false;
        }
      }
    },
    created() {
      this.getList();
      // 查询个人信息
      this.getUser();
    },
    computed: {
      Myhead: function() {
        return {
          Authorization: "Bearer " + getToken()
        }
      },
    },
    methods: {
      // 获取个人信息
      getUser() {
        getUserProfile().then(response => {
          this.user = response.data;
          this.roleGroup = response.data.role;
          this.priviList = response.deptGroup;
          this.worknumber = response.data.empId;
          this.workname = response.data.empName;
          // console.log(response.data);
          // console.log(this.worknumber);
          // console.log(this.workname);
          // console.log(response.data.role);
          // console.log(response.deptGroup);/
          
        });
      },
      // 表单重置
      // 移交按钮操作
      // 这块对于参数有疑问，需要询问和测试
      turnoptions(row) {
        this.dialogVisible = true;
        this.systemIdsysId = row.sysId;
        this.sysName = "移交管理员";
      },
      // 移交管理员弹窗确定提交操作
      submitFormtranfer() {
        // 参数放上去工号和要移交的工号
        this.updateFounder.checkId = Cookies.get("usernamefanr");
        this.updateFounder.userIds = this.tranferform.tranferid;
        console.log(this.systemIdsysId);
        this.updateFounder.systemId = this.systemIdsysId;
        console.log("测试条件", this.updateFounder.checkId, this.updateFounder.userIds ,this.updateFounder.systemId);
        updateFounderBtn(this.updateFounder.checkId, this.updateFounder.userIds,this.updateFounder.systemId).then(response => {
          this.$modal.msgSuccess("移交成功");
          this.verification = true;
          this.dialogVisible = false;
          this.tranferreset();
          this.getList();
        })
      },

      // 移交管理员弹窗确定关闭操作
      canceltranfer() {
        this.dialogVisible = false;
        // 关闭弹框确认禁止
        this.verification = true;
        this.tranferreset();
      },
      
      // 用户状态修改
      handleStatusChange(row) {
        console.log("用户状态修改", row)
        let text = row.status === "0" ? "启用" : "停用";
        // element中的模态框
        this.$modal.confirm('您确认要' + text + '"' + row.sysName + '"管理系统吗？').then(function() {
          // 返回用户状态修改, row.status
          return changeUserStatus(row.sysId);
        }).then(() => {
          this.$modal.msgSuccess(text + "成功");
        }).catch(function() {
          row.status = row.status === "0" ? "1" : "0";
        });
      },

      // 详情中的Table中的删除操作
      AddDelete(e) {
        var add = (e.employeeId);
        for (var i = 0; i < this.gridData.length; i++) {
          if (this.gridData[i].employeeId == add) {
            this.gridData.splice(i, 1);
          }
        }
      },

      // 责任事项选择器
      aa() {
        // console.log(this.dutyList);
        this.form.duty = this.dutyList;
        // console.log(this.form.duty);
      },

      // 点击工号验证按钮
      editelmployId() {
        let userIdData = document.getElementById("userIdInput").value;
        // console.log(this.options.value);
        if(userIdData != '') {
          getEmpById(userIdData).then(response => {
            // console.log(response);
            console.log(response.data);
            if(response.data != '') {
              document.getElementById("userIdInput").value = response.data[0].empId;
              this.form.founder = document.getElementById("userIdInput").value;
              document.getElementById("linkManInput").value = response.data[0].empName;
              this.form.linkMan1 = document.getElementById("linkManInput").value;
              this.aa();
              console.log(this.form.duty);
              // 判断工号，姓名和责任事项的value值等不等空，修改添加按钮的禁止项
              if(this.form.founder != '' || this.form.linkMan1 != '' || this.form.duty != '') {
                this.verification = false;
              }else {
                this.verification = true;
              }
            }else {
              this.verification = true;
              this.empty = true;
              this.$message({
                message: '请输入工号!',
                type: 'error'
              });
            }
          });
        }else {
          this.empty = true;
          this.$message({
            message: '请输入工号!',
            type: 'warning'
          });
        }
      },

      // 移交管理员 工号验证按钮
      editTranferId() {
        let userIdData = document.getElementById("tranferInput").value;
        // console.log(userIdData);
        if(userIdData != '') {
          getEmpById(userIdData).then(response => {
            // console.log(response.data);
            if(response.data != '') {
              document.getElementById("tranferInput").value = response.data[0].empId;
              this.tranferform.tranferid = document.getElementById("tranferInput").value;
              document.getElementById("linkMantranferInput").value = response.data[0].empName;
              this.tranferform.tranferName = document.getElementById("linkMantranferInput").value;
              // 判断工号输入框是否有value值
              if(this.tranferform.tranferid == '') {
                this.verification = true;
              }else {
                this.verification = false;
              }
              // 判断姓名输入框是否有value值
              if(this.tranferform.tranferName != '') {
                this.verification = false;
              }else {
                this.verification = true;
              }
            }else {
              this.verification = true;
              this.$message({
                message: '请输入工号!',
                type: 'error'
              });
            }
          });
        }else {
          this.verification = true;
          this.$message({
            message: '请输入工号!',
            type: 'warning'
          });
        }
      },

      // 点击添加按钮在详情页面中
      editTitle() {
        var addform = {};
        addform.employeeId = this.form.founder;
        addform.linkMan = this.form.linkMan1;
        addform.duty = this.form.duty;
        // console.log("测试this.form", addform);
        if(addform.employeeId != '' || addform.linkMan != '' || addform.duty != '') {
          this.verification = true;
        }else {
          this.verification = false;
          // this.$message({
          //   message: 
          // })
        }
        this.gridData.push(addform);
        this.gridData = this.getsliep();
        // console.log("测试gridData", this.gridData);
        this.form.founder = '';
        this.form.linkMan1 = '';
        this.form.duty = '';
      },
      // 添加表格信息方法
      getsliep() {
        var result = [];
        var obj = {};
        for (var i = 0; i < this.gridData.length; i++) {
          if (!obj[this.gridData[i].employeeId]) {
            result.push(this.gridData[i]);
            obj[this.gridData[i].employeeId] = true;
          }
        }
        return result;
      },
      // 移除图片
      handleRemove(file, fileList) {
        // console.log("测试移除图片", file, fileList);
        // console.log(file, fileList);
      },
      // 加载中进行
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择1个文件,本次选择了${files.length}个文件,共选择了${files.length + fileList.length} 个文件`)
        // console.log("测试移除图片", file, fileList);
        // console.log(file, fileList);
      },
      // 保存图片方法
      handlePreview(file) {
        // console.log("测试上传图片", file);
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
        // console.log("测试上传图片处理", fileList);
        this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        // console.log("测试文件上传成功图片处理", response, file, fileList);
        this.form.imgUrl = response.msg;
      },

      getList() {
        this.loading = true;
        getqueryNavigations().then(response => {
          // console.log("测试是否查询", response.data);
          this.supplierMgmtList = response.data;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          sysId: null,
          sysName: null,
          // 系统分类
          sysType: [],
          // 系统分类
          sysLabel: '',
          sysBu: [],
          imgUrl: null,
          sopUrl: null,
        };
        this.resetForm("form");
      },
      // 移交弹窗窗口重置
      tranferreset() {
        this.tranferform = {
          tranferid: null,
          tranferName: null,
        };
        this.resetForm("tranferform");
      },
      // 搜索按钮操作
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      // 重置按钮操作
      // resetQuery() {
      //   this.resetForm("queryForm");
      //   this.handleQuery();
      // },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.sysId);
        this.single = selection.length !== 1;
        this.multiple = !selection.length;
      },

      changeIT(val) {
        console.log("测试资讯", val);
        if (val == true) {
          this.boo = false;
        } else if (val == false) {
          this.boo = false;
        }
      },
      changePUR(val) {
        console.log("测试采购", val);
        if (val == true) {
          this.boo = false;
        } else if (val == false) {
          this.boo = false;
        }
      },
      changeOA(val) {
        console.log("测试综合", val);
        if (val == true) {
          this.boo = false;
        } else if (val == false) {
          this.boo = false;
        }
      },
      changeOP(val) {
        console.log("测试生产", val);
        if (val == true) {
          this.boo = false;
        } else if (val == false) {
          this.boo = false;
        }
      },
      changeBU1(val) {
        console.log("测试BU1", val);
        if (val == true) {
          this.boo1 = false;
        } else if (val == false) {
          this.boo1 = false;
        }
      },
      changeQC(val) {
        console.log("测试品质", val);
        this.b = val;
        if (val == true) {
          this.zios = false;
        } else if (val == false && this.a == false) {
          this.zios = false;
        }
      },
      changeBU3(val) {
        this.c = val;
        console.log("测试bu3", val);
        if (val == true) {
          this.zios1 = false;
        } else if (val == false && this.d == false) {
          this.zios1 = false;
        }
      },
      changeBU5(val) {
        console.log("测试bu5", val);
        this.d = val;
        if (val == true) {
          this.zios1 = false;
        } else if (val == false && this.c == false) {
          this.zios1 = false;
        }
      },
      // 新增按钮操作
      handleAdd() {
        this.gridData = [];
        this.fileList = [];
        this.reset();
        this.open = true;
        this.title = "添加导航管理";
      },
      // 修改按钮操作
      handleUpdate(row) {
        // console.log("测试修改按钮", row);
        // document.getElementById("linkManInput").value
        this.reset();
        this.open = true;
        var rowsysid = row.sysId;
        const sysId = row.sysId || this.ids;
        var jsonmsg = '';
        // 获取管理系统的ID查询系统信息
        queryNavigationInfo(sysId).then(response => {
          // console.log("测试编辑", response);
          // console.log("测试编辑", response.data);
          for(let i = 0; i < response.data.length; i++) {
            // console.log("测试编辑", response.data[i].sysId);
            if(sysId == response.data[i].sysId) {
              jsonmsg = response.data[i];
              this.form = jsonmsg;
            }
          }
          // console.log("测试",jsonmsg);
          // this.form = jsonmsg;
          this.gridData = jsonmsg.linkMan;
          this.form.founder = jsonmsg.founder;
          // this.form.sysType = jsonmsg.sysType.split(",");
          // this.form.sysType = jsonmsg.sysType.split(",");
          this.open = true;
          this.title = "修改导航管理";
        });
      },
      // 提交按钮
      submitForm() {
        this.$refs["form"].validate(valid => {
          if(valid) {
            const checkId = Cookies.get("usernamefanr");
            // console.log("测试", this.form);
            this.form.linkMan = this.gridData;
            this.form.founder = checkId;
            let syslableData = document.getElementById("SYSLABEL").value;
            let resultData = [];
            if(syslableData.indexOf(",") !== -1) {
              resultData.push(syslableData.split(","));
              this.form.sysLabel = resultData[0];
            }else {
              resultData.push(syslableData);
              this.form.sysLabel = resultData;
            }
            if(this.form.sysId != null) {
              updateuserMgmt(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            }else {
              adduserMgmt(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
      // 删除按钮操作
      handleDelete(row) {
        console.log(row.sysName);
        this.$modal.confirm('您确认删除该系统名称为"' + row.sysName + '"，系统管理编号为"' + row.sysId + '"的管理系统?').then(function() {
          return delmangentMgmt(row.sysId);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
    }
  };
</script>

<style scoped>
.form_sample_code {
  width: 600px;
}
</style>